package com.deayalar.rodandov2.view.adapters;

import java.util.List;

import com.deayalar.rodandov2.R;
import com.deayalar.rodandov2.model.Task;

import android.app.Activity;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class TaskAdapter extends ArrayAdapter<Task>  {
	 
	private final Activity context;
	private final List<Task> taskList;
	
	public TaskAdapter(Activity context,List<Task> taskList) {
		super(context, R.layout.task_list_item, taskList);
		this.context = context;
		this.taskList = taskList;
	}
	
	@Override
	public View getView(int position, View view, ViewGroup parent) {
		
		Task task = getItem(position);    
		
		if (view == null) {
			view = LayoutInflater.from(getContext()).inflate(R.layout.task_list_item, parent, false);
        }
		TextView txtTitle = (TextView) view.findViewById(R.id.task_name);
		txtTitle.setText(task.getText());
		view.setBackgroundColor(Color.parseColor("#b6f9ac"));   //Verde
		return view;
	}

}
